package com.duniptech.engine.core.modeling.api;

import java.util.Set;

import com.duniptech.engine.core.simulation.api.ISimulator;


/**
 * <P>Interface for DEVS atomic models. An atomic model
 * includes the DEVS model and the simulator functionality.
 * It is not neccesary, but in this way the user can modify the 
 * simulator behavior.</P>
 * 
 * @author Jos� Luis Risco Mart�n, Saurabh Mittal.
 */
public interface IAtomic extends IDevs {
	// -------------------------------------------------------------------------
	/**
	 * <P>This function adds a new input port to the component.</P>
	 * @param name The port name.
	 */
	public void addInport(String name);
	/**
	 * <P>This function removes a new input port to the component.</P>
	 * @param name The port name.
	 */
	public void removeInport(String name);
	
	/**
	 * <P>This function adds a new output port to the component.</P>
	 * @param name The port name.
	 */
	public void addOutport(String name);
	/**
	 * <P>This function remove a new output port to the component.</P>
	 * @param name The port name.
	 */
	public void removeOutport(String name);
	/**
	 * <P>This function get the inport names.</P>
	 * @return The set of inport names.
	 */
	public Set<String> getInportNames();
	/**
	 * <P>This function get the outport names.</P>
	 * @return The set of outport names.
	 */
	public Set<String> getOutportNames();
	
	boolean containsInPort(String portName);
	boolean containsOutPort(String portName);
	
// -------------------------------------------------------------------------
	/**
	 * <P>This function returns the component name.</P>
	 * @return The name of the component.
	 */
	public String getName();
	/**
	 * <P>Returns the phase.</P>
	 * @return phase.
	 */
	public String getPhase();
	/**
	 * <P>Returns sigma.</P>
	 * @return sigma.
	 */
	public double getSigma();
	/**
	 * Returns the coupled model that contains to this component.
	 * @return Coupled model that contains to this component.
	 */
	public ICoupled getParent();
	/**
	 * Sets the phase.
	 * @param phase New phase.
	 */
	public void setPhase(String phase);
	/**
	 * Sets the sigma value.
	 * @param sigma New value of sigma.
	 */
	public void setSigma(double sigma);
	/**
	 * Sets the coupled model that contains to this component.
	 * @param parent New coupled model that contains to this component.
	 */
	public void setParent(ICoupled parent);
	
	// EXTRA FUNTIONALLITY
	void passivate();
	void holdIn(String phase, double sigma);
	void advance(double e);
	void logState();
	
	public void setSimulator(ISimulator simulator);
	public ISimulator getSimulator();
}
